package com.ymatou.api.marketingseller.testcase;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;





import com.ymatou.api.marketingseller.service.CancelOrEndPromotionCall;
import com.ymatou.api.marketingseller.service.CreateSellerPromotionCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.AssertService;
import com.ymttest.database.model.YmtSellerPromotion;
import com.ymttest.database.model.YmtSellerPromotionProducts;
import com.ymttest.database.model.YmtSellerPromotionValues;
import com.ymttest.database.mongo.SellerPromotionInfoWapper;
import com.ymttest.database.sqlwapper.YmtSellerPromotionIMapper;
import com.ymttest.database.sqlwapper.YmtSellerPromotionProductsIMapper;
import com.ymttest.database.sqlwapper.YmtSellerPromotionValuesIMapper;
import com.ymttest.utils.YMTDateUtil;

public class Ts_CreateSellerPromotion {
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("创建满减促销活动");
	}

	@Before
	public void caseUp() {
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(new CreateSellerPromotionCall().getOpurl());
	}
	
	
	@After
	public void caseDown() {
		Logger.end();
	}
	

		/*
		 * 不存在任何促销时，全场满减促销活动创建成功
		 */
		
		@Test
		@Category({P1.class})
		@TestCase
		public void Tc_CreateSellerPromotion_001() {
			Logger.start(true, "不存在任何促销时，全场满减促销活动创建成功");
			try{	
				int sellerId = 20323743;
				// 校验是否存在未开始或已开始的满减活动，若存在，则取消
				this.checkIsExistPromotion(sellerId);
				Map<String,Object> map = new HashMap<String,Object>();
				map.put("PromotionInfo->PromotionName","满2件减10-自动");
				map.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				map.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				map.put("PromotionInfo->PromotionType","1");
				map.put("PromotionInfo->IsSpecifyProduct",false);
				map.put("PromotionInfo->IsLimitProduct",false);
				map.put("PromotionInfo->IsSameProductUse",true);
				
				JSONObject retBea = new CreateSellerPromotionCall().callAndGetReturnData(map);
				
				JSONObject retBean = retBea.getJSONObject("JsonBeanRequest").getJSONObject("PromotionInfo");
				// 促销商品ID
				int  promotionId = retBea.getJSONObject("Data").getInt("PromotionId");
				
				if(promotionId == -1){
					System.out.print("满减冲突");
					return;
				} else{
				}
				
				// 买手ID
				int SellerId = retBea.getJSONObject("JsonBeanRequest").getInt("SellerId");
				
				// 促销类型
				int PromotionType = retBean.getInt("PromotionType");
				
				// 促销名称
				String PromotionName = retBean.getString("PromotionName");
				// 促销描述
				String PromotionDesc = retBean.getString("PromotionDesc");
				// 促销开始时间
				Date PromotionBeginTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.parseRespDate2(retBean.getString("PromotionBeginTime")));
			    // 促销结束时间
				Date PromotionEndTime =  YMTDateUtil.parseYMDHMSDate(YMTDateUtil.parseRespDate2(retBean.getString("PromotionEndTime")));
				// 促销限购数
				int PromotionLimitNum = retBean.getInt("PromotionLimitNum");
				// 是否使用商家优惠券
				Boolean CanUseSellerCoupon = retBean.getBoolean("CanUseSellerCoupon");
				// 是否同商品满减
				Boolean IsSameProductUse = retBean.getBoolean("IsSameProductUse");
				// 是否指定商品满减
				Boolean IsSpecifyProduct = retBean.getBoolean("IsSpecifyProduct");
				// 是否排除商品满减
				Boolean IsLimitProduct = retBean.getBoolean("IsLimitProduct");
				// 满减促销优惠条件--满减促销满减件数
				int QtyCondition= retBean.getJSONArray("PromotionValues").getJSONObject(0).getInt("QtyCondition");
				// 满减促销优惠条件--满减徐晓优惠金额或折扣
				String PromotionValues = retBean.getJSONArray("PromotionValues").getJSONObject(0).getString("Value");
				
				// 创建满减促销时间	
				// 获取mongo sellerpromotion库的满减促销数据
				Map<String, Object> mongoDataMap = new SellerPromotionInfoWapper().getPromotionId(promotionId);
				if(mongoDataMap.isEmpty()){
					System.out.print("满减促销创建失败");
					return;
				} else{
				}
				// 校验mongo 数据库数据
				Logger.verifyEquals(SellerId, mongoDataMap.get("SellerId"), "满减促销名称落地");
				// 促销类型
				Logger.verifyEquals(PromotionType, mongoDataMap.get("PromotionType"), "促销类型");
				Logger.verifyEquals(PromotionName, mongoDataMap.get("PromotionName"), "满减促销名称");
				Logger.verifyEquals(PromotionDesc, mongoDataMap.get("PromotionDesc"), "满减促销描述");
				AssertService.assertTime(PromotionBeginTime, (Date)mongoDataMap.get("PromotionBeginTime"), 60);
				AssertService.assertTime(PromotionEndTime, (Date)mongoDataMap.get("PromotionEndTime"), 60);
				Logger.verifyEquals(PromotionLimitNum, mongoDataMap.get("PromotionLimitNum"), "满减促销买家限购数");
				Logger.verifyEquals(CanUseSellerCoupon, mongoDataMap.get("CanUseSellerCoupon"), "满减促销是否使用买手优惠券");
				Logger.verifyEquals(IsSameProductUse, mongoDataMap.get("IsSameProductUse"), "是否同商品满减");
				Logger.verifyEquals(IsSpecifyProduct, mongoDataMap.get("IsSpecifyProduct"), "是否指定商品活动");
				Logger.verifyEquals(IsLimitProduct, mongoDataMap.get("IsLimitProduct"), "是否为排除商品活动");				
				Logger.verifyEquals(QtyCondition, new JSONArray(mongoDataMap.get("PromotionValues").toString()).getJSONObject(0).getInt("QtyCondition"), "满减促销件数");
				Logger.verifyEquals(Float.valueOf(PromotionValues), Float.valueOf(new JSONArray(mongoDataMap.get("PromotionValues").toString()).getJSONObject(0).getString("Value")), "优惠折扣");
				Logger.verifyIsNull(mongoDataMap.get("productIds"), "指定全场商品，商品ID为空");
				// 校验SQL库Ymt_SellerPromotion
				List<YmtSellerPromotion> SellerPromotionlist = new YmtSellerPromotionIMapper().selectPromotionByPromotionId(promotionId);
				if(SellerPromotionlist.isEmpty())
				{
					System.out.print("查询不到满减促销信息");
					return;
				}
				//SellerPromotionlist.get(0).get
				// 校验SQL库Ymt_SellerPromotionProducts
				List<YmtSellerPromotionProducts> sellerPromotionProductsList = new YmtSellerPromotionProductsIMapper().selectProductsByPromotionId(promotionId);
				// 校验SQL库Ymt_SellerPromotionValues 
				List<YmtSellerPromotionValues> sellerPromotionValuesList = new YmtSellerPromotionValuesIMapper().selectPromotionValuesByPromotionId(promotionId);
				if(sellerPromotionValuesList.isEmpty()){
					System.out.print("查询不到满减促销条件");
					return;
				}
				// SQL 数据库落地数据对比
				Logger.verifyEquals(SellerId,SellerPromotionlist.get(0).getSellerId(), "验证买手ID");
				Logger.verifyEquals(PromotionName,SellerPromotionlist.get(0).getPromotionName(), "验证促销名称");
				Logger.verifyEquals(PromotionDesc,SellerPromotionlist.get(0).getPromotionDesc(), "验证促销描述");
				AssertService.assertTime(PromotionBeginTime,SellerPromotionlist.get(0).getPromotionBeginTime(),60);
				AssertService.assertTime(PromotionEndTime,SellerPromotionlist.get(0).getPromotionEndTime(),60);
				Logger.verifyEquals(PromotionType,SellerPromotionlist.get(0).getPromotionType().intValue(), "验证促销类型");
				Logger.verifyEquals(IsSameProductUse,SellerPromotionlist.get(0).getIsSameProductUse(), "是否同商品满减");
				Logger.verifyEquals(CanUseSellerCoupon,SellerPromotionlist.get(0).getCanUseSellerCoupon(), "是否可以使用商家优惠券");
				Logger.verifyIsNull(SellerPromotionlist.get(0).getCouponBatchCode(), "优惠券券码");
				Logger.verifyEquals(PromotionLimitNum,SellerPromotionlist.get(0).getLimitNum(), "限制用户可以买几个");
				Logger.verifyEquals(IsSpecifyProduct,SellerPromotionlist.get(0).getIsSpecifyProduct(), "是否指定商品满减");
				Logger.verifyEquals(IsLimitProduct,SellerPromotionlist.get(0).getIsLimitProduct(), "是否排除商品满减");
				
				if(sellerPromotionProductsList.isEmpty()){
					System.out.print("全场商品促销，商品ID为空");
				}
				
				Logger.verifyEquals(QtyCondition, sellerPromotionValuesList.get(0).getQtyCondition(), "满减促销件数");
				Logger.verifyEquals(Float.valueOf(PromotionValues), Float.valueOf(sellerPromotionValuesList.get(0).getPromotionValue().toString()), "满减促销优惠");
				
			}catch(Exception e){
				Logger.fail(e);
			}
		}
		
		/*
		 * 不存在任何促销活动，创建指定商品促销成功,促销类型:满件折
		 */
		@Test
		@Category({P1.class})
		@TestCase
		public void Tc_CreateSellerPromotion_002() {
			Logger.start(true, "不存在任何促销活动，创建指定商品促销成功,促销类型:满件折");
			try{	
				int sellerId = 20323743;
				// 校验是否存在未开始或已开始的满减活动，若存在，则取消
				this.checkIsExistPromotion(sellerId);
				Map<String,Object> promotionMap = new HashMap<String,Object>();
				promotionMap.put("PromotionInfo->PromotionName","满3件享8.9-自动");
				promotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				promotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				promotionMap.put("PromotionInfo->PromotionType","2");
				promotionMap.put("PromotionInfo->IsSpecifyProduct",true);
				promotionMap.put("PromotionInfo->IsLimitProduct",false);
				promotionMap.put("PromotionInfo->IsSameProductUse",false);
				
				JSONObject retBea = new CreateSellerPromotionCall().callAndGetReturnData(promotionMap);
				
				JSONObject retBean = retBea.getJSONObject("JsonBeanRequest").getJSONObject("PromotionInfo");
				// 促销商品ID
				int  promotionId = retBea.getJSONObject("Data").getInt("PromotionId");
				
				if(promotionId == -1){
					System.out.print("满减冲突");
					return;
				} else{
				}

				// 买手ID
				int SellerId = retBea.getJSONObject("JsonBeanRequest").getInt("SellerId");
				// 促销类型
				int PromotionType = retBean.getInt("PromotionType");
				// 是否同商品满减
				Boolean IsSameProductUse = retBean.getBoolean("IsSameProductUse");
				// 是否指定商品满减
				Boolean IsSpecifyProduct = retBean.getBoolean("IsSpecifyProduct");
				// 是否排除商品满减
				Boolean IsLimitProduct = retBean.getBoolean("IsLimitProduct");
				// 满减促销优惠条件--满减促销满减件数
				int QtyCondition= retBean.getJSONArray("PromotionValues").getJSONObject(0).getInt("QtyCondition");
				// 满减促销优惠条件--满减徐晓优惠金额或折扣
				String PromotionValues = retBean.getJSONArray("PromotionValues").getJSONObject(0).getString("Value");
				// 获取商品ID
				JSONArray productIds =  retBean.getJSONArray("ProductIds");
				// 创建满减促销时间	
				// 获取mongo sellerpromotion库的满减促销数据
				Map<String, Object> mongoDataMap = new SellerPromotionInfoWapper().getPromotionId(promotionId);
				if(mongoDataMap.isEmpty()){
					System.out.print("满减促销创建失败");
					return;
				} else{
				}

				// 促销类型
				Logger.verifyEquals(PromotionType, mongoDataMap.get("PromotionType"), "促销类型");
				Logger.verifyEquals(IsSameProductUse, mongoDataMap.get("IsSameProductUse"), "是否同商品满减");
				Logger.verifyEquals(IsSpecifyProduct, mongoDataMap.get("IsSpecifyProduct"), "是否指定商品活动");
				Logger.verifyEquals(IsLimitProduct, mongoDataMap.get("IsLimitProduct"), "是否为排除商品活动");				
				Logger.verifyEquals(QtyCondition, new JSONArray(mongoDataMap.get("PromotionValues").toString()).getJSONObject(0).getInt("QtyCondition"), "满减促销件数");
				// 校验商品ID
				AssertService.checkArray(productIds, new JSONArray(mongoDataMap.get("ProductIds").toString()));
				Logger.verifyEquals( Float.valueOf(PromotionValues),Float.valueOf(new JSONArray(mongoDataMap.get("PromotionValues").toString()).getJSONObject(0).getString("Value")) *10 , "优惠折扣");
				// 校验SQL库Ymt_SellerPromotion
				List<YmtSellerPromotion> SellerPromotionlist = new YmtSellerPromotionIMapper().selectPromotionByPromotionId(promotionId);
				if(SellerPromotionlist.isEmpty())
				{
					System.out.print("查询不到满减促销信息");
					return;
				}
				// 校验SQL库Ymt_SellerPromotionProducts
				List<YmtSellerPromotionProducts> sellerPromotionProductsList = new YmtSellerPromotionProductsIMapper().selectProductsByPromotionId(promotionId);
				
				JSONArray prodSqlArray = new JSONArray();
				sellerPromotionProductsList.forEach(K->prodSqlArray.put(K.getProductId()));
				// 校验商品ID是否正确
				AssertService.checkArray(productIds,prodSqlArray);
				// 校验SQL库Ymt_SellerPromotionValues 
				List<YmtSellerPromotionValues> sellerPromotionValuesList = new YmtSellerPromotionValuesIMapper().selectPromotionValuesByPromotionId(promotionId);
				if(sellerPromotionValuesList.isEmpty()){
					System.out.print("查询不到满减促销条件");
					return;
				}
				// SQL 数据库落地数据对比
				Logger.verifyEquals(PromotionType,SellerPromotionlist.get(0).getPromotionType().intValue(), "验证促销类型");
				Logger.verifyEquals(IsSameProductUse,SellerPromotionlist.get(0).getIsSameProductUse(), "是否同商品满减");
				Logger.verifyEquals(IsSpecifyProduct,SellerPromotionlist.get(0).getIsSpecifyProduct(), "是否指定商品满减");
				Logger.verifyEquals(IsLimitProduct,SellerPromotionlist.get(0).getIsLimitProduct(), "是否排除商品满减");
				Logger.verifyEquals(QtyCondition, sellerPromotionValuesList.get(0).getQtyCondition(), "满减促销件数");
				Logger.verifyEquals(Float.valueOf(PromotionValues), Float.valueOf(sellerPromotionValuesList.get(0).getPromotionValue().toString())*10, "满减促销优惠");
				
				Map<String,Object> map1 = new HashMap<String,Object>();
				map1.put("SellerId",SellerId);
				map1.put("PromotionId",promotionId);
				if(SellerPromotionlist.get(0).getPromotionState()== 0){
					map1.put("OperatorType",1);
				} else{
					map1.put("OperatorType",2);
				}
				
				JSONObject retBea1 = new CancelOrEndPromotionCall().callAndGetReturnData(map1);
				
				boolean flag = retBea1.getJSONObject("Data").getBoolean("IsSuccess");
				Logger.verifyEquals(true, flag, "验证促销活动是否成功取消");
				
				int code =retBea1.getInt("Code");
				Logger.verifyEquals(200, code, "code是否等于200");
				
			}catch(Exception e){
				Logger.fail(e);
			}
		}
		
		
		
		/*
		 * 不存在任何促销时，创建排除部分商品促销活动创建成功,促销类型:满额减
		 */
		@Test
		@Category({P1.class})
		@TestCase
		public void Tc_CreateSellerPromotion_003() {
			Logger.start(true, "不存在任何促销时，创建排除部分商品促销活动创建成功,促销类型:满额减");
			try{
				int sellerId = 20323743;
				// 校验是否存在未开始或已开始的满减活动，若存在，则取消
				this.checkIsExistPromotion(sellerId);
				Map<String,Object> PromotionMap = new HashMap<String,Object>();
				PromotionMap.put("PromotionInfo->PromotionName","满200减99.99");
				PromotionMap.put("PromotionInfo->PromotionDesc","满200减99.99-自动化测试");
				PromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				PromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				PromotionMap.put("PromotionInfo->PromotionType","3");
				PromotionMap.put("PromotionInfo->IsLimitProduct",true);
				PromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				PromotionMap.put("PromotionInfo->PromotionValues[0]->Value",99.99);
				JSONObject retBea = new CreateSellerPromotionCall().callAndGetReturnData(PromotionMap);
				
				JSONObject retBean = retBea.getJSONObject("JsonBeanRequest").getJSONObject("PromotionInfo");
				// 促销商品ID
				int  promotionId = retBea.getJSONObject("Data").getInt("PromotionId");

				// 买手ID
				int SellerId = retBea.getJSONObject("JsonBeanRequest").getInt("SellerId");
				// 促销类型
				int PromotionType = retBean.getInt("PromotionType");
				// 是否指定商品满减
				Boolean IsSpecifyProduct = retBean.getBoolean("IsSpecifyProduct");
				// 是否排除商品满减
				Boolean IsLimitProduct = retBean.getBoolean("IsLimitProduct");
				// 满减金额
				String amountCondition = retBean.getJSONArray("PromotionValues").getJSONObject(0).getString("AmountCondition");
				// 满减促销优惠条件--满减徐晓优惠金额或折扣
				String PromotionValues = retBean.getJSONArray("PromotionValues").getJSONObject(0).getString("Value");
				// 获取商品ID
				JSONArray productIds =  retBean.getJSONArray("ProductIds");
				// 创建满减促销时间	
				// 获取mongo sellerpromotion库的满减促销数据
				Map<String, Object> mongoDataMap = new SellerPromotionInfoWapper().getPromotionId(promotionId);
				if(mongoDataMap.isEmpty()){
					System.out.print("满减促销创建失败");
					return;
				} else{
				}
				// 促销类型
				Logger.verifyEquals(PromotionType, mongoDataMap.get("PromotionType"), "促销类型");
				Logger.verifyEquals(IsSpecifyProduct, mongoDataMap.get("IsSpecifyProduct"), "是否指定商品活动");
				Logger.verifyEquals(IsLimitProduct, mongoDataMap.get("IsLimitProduct"), "是否为排除商品活动");	
				Logger.verifyEquals(0, new JSONArray(mongoDataMap.get("PromotionValues").toString()).getJSONObject(0).getInt("QtyCondition"), "SQL满减金额");
				Logger.verifyEquals(Float.valueOf(amountCondition), Float.valueOf(new JSONArray(mongoDataMap.get("PromotionValues").toString()).getJSONObject(0).getInt("AmountCondition")), "SQL满减满足金额");
				Logger.verifyEquals( Float.valueOf(PromotionValues),Float.valueOf(new JSONArray(mongoDataMap.get("PromotionValues").toString()).getJSONObject(0).getString("Value")) , "SQL优惠金额");
				// 校验商品ID
				AssertService.checkArray(productIds, new JSONArray(mongoDataMap.get("ProductIds").toString()));// 校验SQL库Ymt_SellerPromotion
				// 校验SQL数据库
				List<YmtSellerPromotion> SellerPromotionlist = new YmtSellerPromotionIMapper().selectPromotionByPromotionId(promotionId);
				if(SellerPromotionlist.isEmpty())
				{
					System.out.print("查询不到满减促销信息");
					return;
				}

				// SQL 数据库落地数据对比
				Logger.verifyEquals(PromotionType,SellerPromotionlist.get(0).getPromotionType().intValue(), "验证促销类型");
				Logger.verifyEquals(IsSpecifyProduct,SellerPromotionlist.get(0).getIsSpecifyProduct(), "是否指定商品满减");
				Logger.verifyEquals(IsLimitProduct,SellerPromotionlist.get(0).getIsLimitProduct(), "是否排除商品满减");
				// 校验SQL库Ymt_SellerPromotionProducts
				List<YmtSellerPromotionProducts> sellerPromotionProductsList = new YmtSellerPromotionProductsIMapper().selectProductsByPromotionId(promotionId);
				JSONArray prodSqlArray = new JSONArray();
				sellerPromotionProductsList.forEach(K->prodSqlArray.put(K.getProductId()));
				// 校验商品ID是否正确
				AssertService.checkArray(productIds,prodSqlArray);
				// 校验SQL库Ymt_SellerPromotionValues 
				List<YmtSellerPromotionValues> sellerPromotionValuesList = new YmtSellerPromotionValuesIMapper().selectPromotionValuesByPromotionId(promotionId);
				if(sellerPromotionValuesList.isEmpty()){
					System.out.print("查询不到满减促销条件");
					return;
				}
				Logger.verifyEquals(0, sellerPromotionValuesList.get(0).getQtyCondition(), "满减促销件数");
				Logger.verifyEquals(Float.valueOf(amountCondition), Float.valueOf(sellerPromotionValuesList.get(0).getAmountCondition().toString()), "满减促销优惠");
				Logger.verifyEquals(Float.valueOf(PromotionValues), Float.valueOf(sellerPromotionValuesList.get(0).getPromotionValue().toString()), "满减促销优惠");
				
				
				Map<String,Object> map1 = new HashMap<String,Object>();
				map1.put("SellerId",SellerId);
				map1.put("PromotionId",promotionId);
				if(SellerPromotionlist.get(0).getPromotionState()== 0){
					map1.put("OperatorType",1);
				} else{
					map1.put("OperatorType",2);
				}
				
				JSONObject retBea1 = new CancelOrEndPromotionCall().callAndGetReturnData(map1);
				
				boolean flag = retBea1.getJSONObject("Data").getBoolean("IsSuccess");
				Logger.verifyEquals(true, flag, "验证促销活动是否成功取消");
				
				int code =retBea1.getInt("Code");
				Logger.verifyEquals(200, code, "code是否等于200");
				
			}catch(Exception e){
				Logger.fail(e);
			}
		}
		
		/*
		 * 不存在任何促销，创建指定商品促销成功,促销类型:满额折，指定部分商品
		 */
		@Test
		@Category({P1.class})
		@TestCase
		public void Tc_CreateSellerPromotion_004() {
			Logger.start(true, "不存在任何促销，创建指定商品促销成功,促销类型:满额折，指定部分商品");
			try{	
				int sellerId = 20323743;
				// 校验是否存在未开始或已开始的满减活动，若存在，则取消
				this.checkIsExistPromotion(sellerId);
				Map<String,Object> PromotionMap = new HashMap<String,Object>();
				PromotionMap.put("PromotionInfo->PromotionName","满200减8.9");
				PromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				PromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				PromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				PromotionMap.put("PromotionInfo->PromotionType","4");
				PromotionMap.put("PromotionInfo->IsSpecifyProduct",true);
				PromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				PromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				JSONObject retBea = new CreateSellerPromotionCall().callAndGetReturnData(PromotionMap);
				
				JSONObject retBean = retBea.getJSONObject("JsonBeanRequest").getJSONObject("PromotionInfo");
				// 促销商品ID
				int  promotionId = retBea.getJSONObject("Data").getInt("PromotionId");
				// 买手ID
				int SellerId = retBea.getJSONObject("JsonBeanRequest").getInt("SellerId");
				// 促销类型
				int PromotionType = retBean.getInt("PromotionType");
				// 是否指定商品满减
				Boolean IsSpecifyProduct = retBean.getBoolean("IsSpecifyProduct");
				// 是否排除商品满减
				Boolean IsLimitProduct = retBean.getBoolean("IsLimitProduct");
				// 满减金额
				String amountCondition = retBean.getJSONArray("PromotionValues").getJSONObject(0).getString("AmountCondition");
				// 满减促销优惠条件--满减徐晓优惠金额或折扣
				String PromotionValues = retBean.getJSONArray("PromotionValues").getJSONObject(0).getString("Value");
				// 获取商品ID
				JSONArray productIds =  retBean.getJSONArray("ProductIds");
				int ConflictType =retBea.getJSONObject("Data").getInt("ConflictType"); 
				if(ConflictType !=0){
					System.out.println("存在满减冲突");
				}
				// 创建满减促销时间	
				// 获取mongo sellerpromotion库的满减促销数据
				Map<String, Object> mongoDataMap = new SellerPromotionInfoWapper().getPromotionId(promotionId);
				if(mongoDataMap.isEmpty()){
					System.out.print("满减促销创建失败");
					return;
				} else{
				}
				// 促销类型
				Logger.verifyEquals(PromotionType, mongoDataMap.get("PromotionType"), "促销类型");
				Logger.verifyEquals(IsSpecifyProduct, mongoDataMap.get("IsSpecifyProduct"), "是否指定商品活动");
				Logger.verifyEquals(IsLimitProduct, mongoDataMap.get("IsLimitProduct"), "是否为排除商品活动");	
				Logger.verifyEquals(0, new JSONArray(mongoDataMap.get("PromotionValues").toString()).getJSONObject(0).getInt("QtyCondition"), "SQL满减金额");
				Logger.verifyEquals(Float.valueOf(amountCondition), Float.valueOf(new JSONArray(mongoDataMap.get("PromotionValues").toString()).getJSONObject(0).getInt("AmountCondition")), "SQL满减满足金额");
				Logger.verifyEquals( Float.valueOf(PromotionValues),Float.valueOf(new JSONArray(mongoDataMap.get("PromotionValues").toString()).getJSONObject(0).getString("Value"))*10 , "SQL优惠金额");
				// 校验商品ID
				AssertService.checkArray(productIds, new JSONArray(mongoDataMap.get("ProductIds").toString()));// 校验SQL库Ymt_SellerPromotion
				// 校验SQL数据库
				List<YmtSellerPromotion> SellerPromotionlist = new YmtSellerPromotionIMapper().selectPromotionByPromotionId(promotionId);
				if(SellerPromotionlist.isEmpty())
				{
					System.out.print("查询不到满减促销信息");
					return;
				}

				// SQL 数据库落地数据对比
				Logger.verifyEquals(PromotionType,SellerPromotionlist.get(0).getPromotionType().intValue(), "验证促销类型");
				Logger.verifyEquals(IsSpecifyProduct,SellerPromotionlist.get(0).getIsSpecifyProduct(), "是否指定商品满减");
				Logger.verifyEquals(IsLimitProduct,SellerPromotionlist.get(0).getIsLimitProduct(), "是否排除商品满减");
				// 校验SQL库Ymt_SellerPromotionProducts
				List<YmtSellerPromotionProducts> sellerPromotionProductsList = new YmtSellerPromotionProductsIMapper().selectProductsByPromotionId(promotionId);
				JSONArray prodSqlArray = new JSONArray();
				sellerPromotionProductsList.forEach(K->prodSqlArray.put(K.getProductId()));
				// 校验商品ID是否正确
				AssertService.checkArray(productIds,prodSqlArray);
				// 校验SQL库Ymt_SellerPromotionValues 
				List<YmtSellerPromotionValues> sellerPromotionValuesList = new YmtSellerPromotionValuesIMapper().selectPromotionValuesByPromotionId(promotionId);
				if(sellerPromotionValuesList.isEmpty()){
					System.out.print("查询不到满减促销条件");
					return;
				}
				Logger.verifyEquals(0, sellerPromotionValuesList.get(0).getQtyCondition(), "满减促销件数");
				Logger.verifyEquals(Float.valueOf(amountCondition), Float.valueOf(sellerPromotionValuesList.get(0).getAmountCondition().toString()), "满减促销优惠");
				Logger.verifyEquals(Float.valueOf(PromotionValues), Float.valueOf(sellerPromotionValuesList.get(0).getPromotionValue().toString())*10, "满减促销优惠");
				
				
				Map<String,Object> map1 = new HashMap<String,Object>();
				map1.put("SellerId",SellerId);
				map1.put("PromotionId",promotionId);
				if(SellerPromotionlist.get(0).getPromotionState()== 0){
					map1.put("OperatorType",1);
				} else{
					map1.put("OperatorType",2);
				}
				
				JSONObject retBea1 = new CancelOrEndPromotionCall().callAndGetReturnData(map1);
				
				boolean flag = retBea1.getJSONObject("Data").getBoolean("IsSuccess");
				Logger.verifyEquals(true, flag, "验证促销活动是否成功取消");
				
				int code =retBea1.getInt("Code");
				Logger.verifyEquals(200, code, "code是否等于200");
				
			}catch(Exception e){
				Logger.fail(e);
			}
		}
		
		
		/*
		 * 存在全场促销，创建指定商品促销失败
		 */
		@Test
		@Category({P1.class})
		@TestCase
		public void Tc_CreateSellerPromotion_005() {
			Logger.start(false, "存在全场促销，创建指定商品促销失败");
			try{	
				int sellerId = 20323743;
				// 校验是否存在未开始或已开始的满减活动，若存在，则取消
				this.checkIsExistPromotion(sellerId);
				// 创建全场促销
				Map<String,Object> allproductMap = new HashMap<String,Object>();
				allproductMap.put("PromotionInfo->PromotionName","全场促销");
				allproductMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				allproductMap.put("PromotionInfo->PromotionType","4");
				allproductMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				allproductMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				allproductMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				allproductMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				JSONObject allproducBea = new CreateSellerPromotionCall().callAndGetReturnData(allproductMap);
				// 创建指定商品促销
				Map<String,Object> SecondPromotionMap = new HashMap<String,Object>();
				SecondPromotionMap.put("PromotionInfo->PromotionName","指定商品促销");
				SecondPromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				SecondPromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				SecondPromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				SecondPromotionMap.put("PromotionInfo->IsSpecifyProduct",true);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				JSONObject isSpecifyProductBea = new CreateSellerPromotionCall().callAndGetReturnData(SecondPromotionMap);
				//创建的全场活动ID
				int  promotionId = allproducBea.getJSONObject("Data").getInt("PromotionId");
				// 促销活动创建成功的标记
				boolean  promoitonFlg = isSpecifyProductBea.getJSONObject("Data").getBoolean("IsSuccess");
				
				Logger.verifyEquals(false, promoitonFlg, "满减促销冲突");
				Logger.verifyEquals(1, isSpecifyProductBea.getJSONObject("Data").getInt("ConflictType"), "满减促销冲突类型为1(存在全场促销活动)");
				Logger.verifyEquals("已经创建过全场促销活动", isSpecifyProductBea.getJSONObject("Data").getString("Msg"), "满减促销冲突提醒");
				Logger.verifyEquals(-1, isSpecifyProductBea.getJSONObject("Data").getInt("PromotionId"), "促销创建失败返回促销活动ID");
				JSONObject conflictPromotionsobj=(JSONObject) isSpecifyProductBea.getJSONObject("Data").getJSONArray("ConflictPromotions").get(0);
				
				Logger.verifyEquals(promotionId,conflictPromotionsobj.getInt("PromotionId"),"与创建的满减促销冲突活动ID");
				Logger.verifyIsNull(isSpecifyProductBea.getJSONObject("Data").getString("ConflictProducts"), "冲突商品ID为空");
			}catch(Exception e){
				Logger.fail(e);
			}
			
		}
		
		
		/*
		 * 存在全场促销，创建排除部分商品促销失败
		 */
		@Test
		@Category({P1.class})
		@TestCase
		public void Tc_CreateSellerPromotion_006() {
			Logger.start(false, "存在全场促销，创建排除部分商品促销失败");
			try{	
				int sellerId = 20323743;
				// 校验是否存在未开始或已开始的满减活动，若存在，则取消
				this.checkIsExistPromotion(sellerId);
				// 创建全场促销
				Map<String,Object> allproductMap = new HashMap<String,Object>();
				allproductMap.put("PromotionInfo->PromotionName","全场促销");
				allproductMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				allproductMap.put("PromotionInfo->PromotionType","4");
				allproductMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				allproductMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				allproductMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				allproductMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				JSONObject allproducBea = new CreateSellerPromotionCall().callAndGetReturnData(allproductMap);
				// 创建指定商品促销
				Map<String,Object> SecondPromotionMap = new HashMap<String,Object>();
				SecondPromotionMap.put("PromotionInfo->PromotionName","排除部分商品促销");
				SecondPromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				SecondPromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				SecondPromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				SecondPromotionMap.put("PromotionInfo->IsLimitProduct",true);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				JSONObject isLimitProductBea = new CreateSellerPromotionCall().callAndGetReturnData(SecondPromotionMap);
				//创建的全场活动ID
				int  promotionId = allproducBea.getJSONObject("Data").getInt("PromotionId");
				// 促销活动创建成功的标记
				boolean  promoitonFlg = isLimitProductBea.getJSONObject("Data").getBoolean("IsSuccess");
				
				Logger.verifyEquals(false, promoitonFlg, "满减促销冲突");
				Logger.verifyEquals(1, isLimitProductBea.getJSONObject("Data").getInt("ConflictType"), "满减促销冲突类型为1(存在全场促销活动)");
				Logger.verifyEquals("已经创建过全场促销活动", isLimitProductBea.getJSONObject("Data").getString("Msg"), "满减促销冲突提醒");
				Logger.verifyEquals(-1, isLimitProductBea.getJSONObject("Data").getInt("PromotionId"), "促销创建失败返回促销活动ID");
				JSONObject conflictPromotionsobj=(JSONObject) isLimitProductBea.getJSONObject("Data").getJSONArray("ConflictPromotions").get(0);
				
				Logger.verifyEquals(promotionId,conflictPromotionsobj.getInt("PromotionId"),"与创建的满减促销冲突活动ID");
				Logger.verifyIsNull(isLimitProductBea.getJSONObject("Data").getString("ConflictProducts"), "冲突商品ID为空");
			}catch(Exception e){
				Logger.fail(e);
			}
			
		}
		

		/*
		 * 存在全场促销，创建全场商品促销失败
		 */
		@Test
		@Category({P1.class})
		@TestCase
		public void Tc_CreateSellerPromotion_007() {
			Logger.start(false, "存在全场促销，创建全场商品促销失败");
			try{	
				int sellerId = 20323743;
				// 校验是否存在未开始或已开始的满减活动，若存在，则取消
				this.checkIsExistPromotion(sellerId);
				// 创建全场促销
				Map<String,Object> allproductMap = new HashMap<String,Object>();
				allproductMap.put("PromotionInfo->PromotionName","全场促销");
				allproductMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				allproductMap.put("PromotionInfo->PromotionType","4");
				allproductMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				allproductMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				allproductMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				allproductMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				JSONObject allproducBea = new CreateSellerPromotionCall().callAndGetReturnData(allproductMap);
				// 创建全场商品促销
				Map<String,Object> SecondPromotionMap = new HashMap<String,Object>();
				SecondPromotionMap.put("PromotionInfo->PromotionName","全场商品促销");
				SecondPromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				SecondPromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				SecondPromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				JSONObject SecondPromotionBea = new CreateSellerPromotionCall().callAndGetReturnData(SecondPromotionMap);
				//创建的全场活动ID
				int  promotionId = allproducBea.getJSONObject("Data").getInt("PromotionId");
				// 促销活动创建成功的标记
				boolean  promoitonFlg = SecondPromotionBea.getJSONObject("Data").getBoolean("IsSuccess");
				
				Logger.verifyEquals(false, promoitonFlg, "满减促销冲突");
				Logger.verifyEquals(1, SecondPromotionBea.getJSONObject("Data").getInt("ConflictType"), "满减促销冲突类型为1(存在全场促销活动)");
				Logger.verifyEquals("已经创建过全场促销活动", SecondPromotionBea.getJSONObject("Data").getString("Msg"), "满减促销冲突提醒");
				Logger.verifyEquals(-1, SecondPromotionBea.getJSONObject("Data").getInt("PromotionId"), "促销创建失败返回促销活动ID");
				JSONObject conflictPromotionsobj=(JSONObject) SecondPromotionBea.getJSONObject("Data").getJSONArray("ConflictPromotions").get(0);	
				Logger.verifyEquals(promotionId,conflictPromotionsobj.getInt("PromotionId"),"与创建的满减促销冲突活动ID");
				Logger.verifyIsNull(SecondPromotionBea.getJSONObject("Data").getString("ConflictProducts"), "冲突商品ID为空");
			}catch(Exception e){
				Logger.fail(e);
			}
			
		}
		
		/*
		 * 存在指定商品A的促销，创建指定商品A的促销失败
		 */
		@Test
		@Category({P1.class})
		@TestCase
		public void Tc_CreateSellerPromotion_008() {
			Logger.start(false, "存在指定商品A的促销，创建指定商品A的促销失败");
			try{	
				int sellerId = 20323743;
				// 校验是否存在未开始或已开始的满减活动，若存在，则取消
				this.checkIsExistPromotion(sellerId);
				// 创建指定商品A促销
				Map<String,Object> FirstpromotionMap = new HashMap<String,Object>();
				FirstpromotionMap.put("SellerId", sellerId);
				FirstpromotionMap.put("PromotionInfo->PromotionName","指定商品A促销");
				FirstpromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				FirstpromotionMap.put("PromotionInfo->PromotionType","4");
				FirstpromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				FirstpromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				FirstpromotionMap.put("PromotionInfo->IsSpecifyProduct",true);
				FirstpromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				FirstpromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				FirstpromotionMap.put("PromotionInfo->ProductIds",new JSONArray("[f0e7200f-2577-4a24-8d3b-45e76f7ab527]"));
				
				JSONObject FirstPromotionBean = new CreateSellerPromotionCall().callAndGetReturnData(FirstpromotionMap);
				// 创建指定商品促销
				Map<String,Object> SecondPromotionMap = new HashMap<String,Object>();
				SecondPromotionMap.put("SellerId", sellerId);
				SecondPromotionMap.put("PromotionInfo->PromotionName","指定商品A促销");
				SecondPromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				SecondPromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				SecondPromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				SecondPromotionMap.put("PromotionInfo->IsSpecifyProduct",true);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				SecondPromotionMap.put("PromotionInfo->ProductIds",new JSONArray("[f0e7200f-2577-4a24-8d3b-45e76f7ab527]"));
				
				JSONObject SecondPromotionBea = new CreateSellerPromotionCall().callAndGetReturnData(SecondPromotionMap);
				//创建指定商品促销活动ID
				int  promotionId = FirstPromotionBean.getJSONObject("Data").getInt("PromotionId");
				// 校验SQL库Ymt_SellerPromotionProducts
				List<YmtSellerPromotionProducts> sellerPromotionProductsList = new YmtSellerPromotionProductsIMapper().selectProductsByPromotionId(promotionId);
				JSONArray prodSqlArray = new JSONArray();
				sellerPromotionProductsList.forEach(K->prodSqlArray.put(K.getProductId()));
				JSONArray conflictProductIds= SecondPromotionBea.getJSONObject("Data").getJSONArray("ConflictPromotions").getJSONObject(0).getJSONArray("ProductIds");	

				// 校校验冲突商品是否正确
				AssertService.checkArray(prodSqlArray, conflictProductIds);
				// 促销活动创建成功的标记
				boolean  promoitonFlg = SecondPromotionBea.getJSONObject("Data").getBoolean("IsSuccess");
				Logger.verifyEquals(false, promoitonFlg, "满减促销冲突");
				Logger.verifyEquals(2, SecondPromotionBea.getJSONObject("Data").getInt("ConflictType"), "满减促销冲突类型为2指定商品与其它促销活动冲突");
				Logger.verifyEquals("指定商品与其它促销活动冲突（促销名称：指定商品A促销）", SecondPromotionBea.getJSONObject("Data").getString("Msg"), "满减促销冲突提醒");
				Logger.verifyEquals(-1, SecondPromotionBea.getJSONObject("Data").getInt("PromotionId"), "促销创建失败返回促销活动ID");
				Logger.verifyEquals(promotionId,SecondPromotionBea.getJSONObject("Data").getJSONArray("ConflictPromotions").getJSONObject(0).getInt("PromotionId"),"与创建的满减促销冲突活动ID");
			}catch(Exception e){
				Logger.fail(e);
			}
			
		}
		
		/*
		 * 存在指定商品A的促销，创建排除商品A，B的促销成功
		 */
		@Test
		@Category({P1.class})
		@TestCase
		public void Tc_CreateSellerPromotion_009() {
			Logger.start(true, "存在指定商品A的促销，创建排除商品A，B的促销成功");
			try{	
				int sellerId = 20323743;
				// 校验是否存在未开始或已开始的满减活动，若存在，则取消
				this.checkIsExistPromotion(sellerId);
				// 创建指定商品A促销
				Map<String,Object> FirstpromotionMap = new HashMap<String,Object>();
				FirstpromotionMap.put("SellerId", sellerId);
				FirstpromotionMap.put("PromotionInfo->PromotionName","指定商品A促销");
				FirstpromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				FirstpromotionMap.put("PromotionInfo->PromotionType","4");
				FirstpromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				FirstpromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				FirstpromotionMap.put("PromotionInfo->IsSpecifyProduct",true);
				FirstpromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				FirstpromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				FirstpromotionMap.put("PromotionInfo->ProductIds",new JSONArray("[f0e7200f-2577-4a24-8d3b-45e76f7ab527]"));
				
				JSONObject FirstPromotionBean = new CreateSellerPromotionCall().callAndGetReturnData(FirstpromotionMap);
				// 创建指定商品促销
				Map<String,Object> SecondPromotionMap = new HashMap<String,Object>();
				SecondPromotionMap.put("SellerId", sellerId);
				SecondPromotionMap.put("PromotionInfo->PromotionName","排除商品A促销");
				SecondPromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				SecondPromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				SecondPromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				SecondPromotionMap.put("PromotionInfo->IsLimitProduct",true);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				SecondPromotionMap.put("PromotionInfo->ProductIds",new JSONArray("[f0e7200f-2577-4a24-8d3b-45e76f7ab527,bf92baaa-acb2-4de7-bb2d-792a5322bc02]"));
				JSONObject SecondPromotionBea = new CreateSellerPromotionCall().callAndGetReturnData(SecondPromotionMap);
				// 促销活动创建成功的标记
				boolean  promoitonFlg = SecondPromotionBea.getJSONObject("Data").getBoolean("IsSuccess");
				Logger.verifyEquals(true, promoitonFlg, "促销创建成功");
				Logger.verifyEquals("促销活动创建成功", SecondPromotionBea.getJSONObject("Data").getString("Msg"), "促销创建成功提示语");
			}catch(Exception e){
				Logger.fail(e);
			}
			
		}
		
		/*
		 * 存在指定商品A的促销，创建全场促销失败
		 */
		@Test
		@Category({P1.class})
		@TestCase
		public void Tc_CreateSellerPromotion_010() {
			Logger.start(false, "存在指定商品A的促销，创建全场促销失败");
			try{	
				int sellerId = 20323743;
				// 校验是否存在未开始或已开始的满减活动，若存在，则取消
				this.checkIsExistPromotion(sellerId);
				// 创建指定商品A促销
				Map<String,Object> FirstpromotionMap = new HashMap<String,Object>();
				FirstpromotionMap.put("SellerId", sellerId);
				FirstpromotionMap.put("PromotionInfo->PromotionName","指定商品A促销");
				FirstpromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				FirstpromotionMap.put("PromotionInfo->PromotionType","4");
				FirstpromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				FirstpromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				FirstpromotionMap.put("PromotionInfo->IsSpecifyProduct",true);
				FirstpromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				FirstpromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				FirstpromotionMap.put("PromotionInfo->ProductIds",new JSONArray("[f0e7200f-2577-4a24-8d3b-45e76f7ab527,bf92baaa-acb2-4de7-bb2d-792a5322bc02]"));
				
				JSONObject FirstPromotionBean = new CreateSellerPromotionCall().callAndGetReturnData(FirstpromotionMap);
				// 创建全场商品促销
				Map<String,Object> SecondPromotionMap = new HashMap<String,Object>();
				SecondPromotionMap.put("SellerId", sellerId);
				SecondPromotionMap.put("PromotionInfo->PromotionName","全场商品促销");
				SecondPromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				SecondPromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				SecondPromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				JSONObject SecondPromotionBea = new CreateSellerPromotionCall().callAndGetReturnData(SecondPromotionMap);
				// 促销活动创建成功的标记
				boolean  promoitonFlg = SecondPromotionBea.getJSONObject("Data").getBoolean("IsSuccess");	
				//创建指定商品促销活动ID
				int  promotionId = FirstPromotionBean.getJSONObject("Data").getInt("PromotionId");
				// 校验SQL库Ymt_SellerPromotionProducts
				List<YmtSellerPromotionProducts> sellerPromotionProductsList = new YmtSellerPromotionProductsIMapper().selectProductsByPromotionId(promotionId);
				JSONArray prodSqlArray = new JSONArray();
				sellerPromotionProductsList.forEach(K->prodSqlArray.put(K.getProductId()));
				JSONArray conflictProductIds= SecondPromotionBea.getJSONObject("Data").getJSONArray("ConflictPromotions").getJSONObject(0).getJSONArray("ProductIds");	

				// 校校验冲突商品是否正确
				AssertService.checkArray(prodSqlArray, conflictProductIds);
				// 促销活动创建成功的标记
				Logger.verifyEquals(false, promoitonFlg, "满减促销冲突");
				Logger.verifyEquals(1, SecondPromotionBea.getJSONObject("Data").getInt("ConflictType"), "存在满减促销，不能创建全场促销");
				Logger.verifyEquals(-1, SecondPromotionBea.getJSONObject("Data").getInt("PromotionId"), "促销创建失败返回促销活动ID");
				Logger.verifyEquals(promotionId,SecondPromotionBea.getJSONObject("Data").getJSONArray("ConflictPromotions").getJSONObject(0).getInt("PromotionId"),"与创建的满减促销冲突活动ID");
				
			}catch(Exception e){
				Logger.fail(e);
			}
			
		}
		
		
		/*
		 * 存在排除商品A的促销，创建排除商品A的促销失败
		 */
		@Test
		@Category({P1.class})
		@TestCase
		public void Tc_CreateSellerPromotion_012() {
			Logger.start(false, "存在排除商品A的促销，创建排除商品A的促销失败");
			try{	
				int sellerId = 20323743;
				// 校验是否存在未开始或已开始的满减活动，若存在，则取消
				this.checkIsExistPromotion(sellerId);
				// 创建指定商品A促销
				Map<String,Object> FirstpromotionMap = new HashMap<String,Object>();
				FirstpromotionMap.put("SellerId", sellerId);
				FirstpromotionMap.put("PromotionInfo->PromotionName","排除商品A促销");
				FirstpromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				FirstpromotionMap.put("PromotionInfo->PromotionType","4");
				FirstpromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				FirstpromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				FirstpromotionMap.put("PromotionInfo->IsLimitProduct",true);
				FirstpromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				FirstpromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				FirstpromotionMap.put("PromotionInfo->ProductIds",new JSONArray("[f0e7200f-2577-4a24-8d3b-45e76f7ab527]"));
				
				JSONObject FirstPromotionBean = new CreateSellerPromotionCall().callAndGetReturnData(FirstpromotionMap);
				// 创建指定商品促销
				Map<String,Object> SecondPromotionMap = new HashMap<String,Object>();
				SecondPromotionMap.put("SellerId", sellerId);
				SecondPromotionMap.put("PromotionInfo->PromotionName","排除商品A促销");
				SecondPromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				SecondPromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				SecondPromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				SecondPromotionMap.put("PromotionInfo->IsLimitProduct",true);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				SecondPromotionMap.put("PromotionInfo->ProductIds",new JSONArray("[f0e7200f-2577-4a24-8d3b-45e76f7ab527]"));
				
				JSONObject SecondPromotionsBea = new CreateSellerPromotionCall().callAndGetReturnData(SecondPromotionMap);
				//创建指定商品促销活动ID
				int  promotionId = FirstPromotionBean.getJSONObject("Data").getInt("PromotionId");
				// 校验SQL库Ymt_SellerPromotionProducts
				List<YmtSellerPromotionProducts> sellerPromotionProductsList = new YmtSellerPromotionProductsIMapper().selectProductsByPromotionId(promotionId);
				JSONArray prodSqlArray = new JSONArray();
				sellerPromotionProductsList.forEach(K->prodSqlArray.put(K.getProductId()));
				JSONArray conflictProductIds= SecondPromotionsBea.getJSONObject("Data").getJSONArray("ConflictPromotions").getJSONObject(0).getJSONArray("ProductIds");	

				// 校校验冲突商品是否正确
				AssertService.checkArray(prodSqlArray, conflictProductIds);
				// 促销活动创建成功的标记
				boolean  promoitonFlg = SecondPromotionsBea.getJSONObject("Data").getBoolean("IsSuccess");
				Logger.verifyEquals(false, promoitonFlg, "满减促销冲突");
				Logger.verifyEquals(1, SecondPromotionsBea.getJSONObject("Data").getInt("ConflictType"), "存在排除商品促销，不能创建排除商品促销");
				Logger.verifyEquals("已经创建过排除部分商品促销活动", SecondPromotionsBea.getJSONObject("Data").getString("Msg"), "满减促销冲突提醒");
				Logger.verifyEquals(-1, SecondPromotionsBea.getJSONObject("Data").getInt("PromotionId"), "促销创建失败返回促销活动ID");
				Logger.verifyEquals(promotionId,SecondPromotionsBea.getJSONObject("Data").getJSONArray("ConflictPromotions").getJSONObject(0).getInt("PromotionId"),"与创建的满减促销冲突活动ID");
			}catch(Exception e){
				Logger.fail(e);
			}
			
		}
		
		/*
		 * 存在排除商品A的促销，创建指定商品A的促销成功
		 */
		@Test
		@Category({P1.class})
		@TestCase
		public void Tc_CreateSellerPromotion_013() {
			Logger.start(true, "存在排除商品A的促销，创建指定商品A的促销成功");
			try{	
				int sellerId = 20323743;
				// 校验是否存在未开始或已开始的满减活动，若存在，则取消
				this.checkIsExistPromotion(sellerId);
				// 创建指定商品A促销
				Map<String,Object> FirstpromotionMap = new HashMap<String,Object>();
				FirstpromotionMap.put("SellerId", sellerId);
				FirstpromotionMap.put("PromotionInfo->PromotionName","排除商品A促销");
				FirstpromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				FirstpromotionMap.put("PromotionInfo->PromotionType","4");
				FirstpromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				FirstpromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				FirstpromotionMap.put("PromotionInfo->IsLimitProduct",true);
				FirstpromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				FirstpromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				FirstpromotionMap.put("PromotionInfo->ProductIds",new JSONArray("[f0e7200f-2577-4a24-8d3b-45e76f7ab527]"));
				
				JSONObject FirstPromotionBean = new CreateSellerPromotionCall().callAndGetReturnData(FirstpromotionMap);
				// 创建指定商品促销
				Map<String,Object> SecondPromotionMap = new HashMap<String,Object>();
				SecondPromotionMap.put("SellerId", sellerId);
				SecondPromotionMap.put("PromotionInfo->PromotionName","指定商品A促销");
				SecondPromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				SecondPromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				SecondPromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				SecondPromotionMap.put("PromotionInfo->IsSpecifyProduct",true);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				
				JSONObject ConflictProductsBea = new CreateSellerPromotionCall().callAndGetReturnData(SecondPromotionMap);
				// 促销活动创建成功的标记
				boolean  promoitonFlg = ConflictProductsBea.getJSONObject("Data").getBoolean("IsSuccess");
				Logger.verifyEquals(true, promoitonFlg, "促销创建成功");
			}catch(Exception e){
				Logger.fail(e);
			}
			
		}
		
		/*
		 * 存在排除商品A的促销，创建全场商品促销失败
		 */
		@Test
		@Category({P1.class})
		@TestCase
		public void Tc_CreateSellerPromotion_014() {
			Logger.start(false, "存在排除商品A的促销，创建全场商品促销失败");
			try{	
				int sellerId = 20323743;
				// 校验是否存在未开始或已开始的满减活动，若存在，则取消
				this.checkIsExistPromotion(sellerId);
				// 存在排除商品A的促销
				Map<String,Object> FirstpromotionMap = new HashMap<String,Object>();
				FirstpromotionMap.put("SellerId", sellerId);
				FirstpromotionMap.put("PromotionInfo->PromotionName","排除商品A促销");
				FirstpromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				FirstpromotionMap.put("PromotionInfo->PromotionType","4");
				FirstpromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				FirstpromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				FirstpromotionMap.put("PromotionInfo->IsLimitProduct",true);
				FirstpromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				FirstpromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				FirstpromotionMap.put("PromotionInfo->ProductIds",new JSONArray("[f0e7200f-2577-4a24-8d3b-45e76f7ab527]"));
				
				JSONObject FirstPromotionBean = new CreateSellerPromotionCall().callAndGetReturnData(FirstpromotionMap);
				// 创建全场商品促销
				Map<String,Object> SecondPromotionMap = new HashMap<String,Object>();
				SecondPromotionMap.put("SellerId", sellerId);
				SecondPromotionMap.put("PromotionInfo->PromotionName","全场商品促销");
				SecondPromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				SecondPromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				SecondPromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				
				JSONObject ConflictProductsBea = new CreateSellerPromotionCall().callAndGetReturnData(SecondPromotionMap);
				//排除商品A的促销活动ID
				int  promotionId = FirstPromotionBean.getJSONObject("Data").getInt("PromotionId");
				// 校验SQL库Ymt_SellerPromotionProducts
				List<YmtSellerPromotionProducts> sellerPromotionProductsList = new YmtSellerPromotionProductsIMapper().selectProductsByPromotionId(promotionId);
				JSONArray prodSqlArray = new JSONArray();
				sellerPromotionProductsList.forEach(K->prodSqlArray.put(K.getProductId()));
				JSONArray conflictProductIds= ConflictProductsBea.getJSONObject("Data").getJSONArray("ConflictPromotions").getJSONObject(0).getJSONArray("ProductIds");	

				// 校校验冲突商品是否正确
				AssertService.checkArray(prodSqlArray, conflictProductIds);
				// 促销活动创建成功的标记
				boolean  promoitonFlg = ConflictProductsBea.getJSONObject("Data").getBoolean("IsSuccess");
				Logger.verifyEquals(false, promoitonFlg, "满减促销冲突");
				Logger.verifyEquals(1, ConflictProductsBea.getJSONObject("Data").getInt("ConflictType"), "满减促销冲突类型为1(存在全场促销活动)");
				Logger.verifyEquals("已经创建过促销活动，不能再创建全场促销活动", ConflictProductsBea.getJSONObject("Data").getString("Msg"), "满减促销冲突提醒");
				Logger.verifyEquals(-1, ConflictProductsBea.getJSONObject("Data").getInt("PromotionId"), "促销创建失败返回促销活动ID");
				Logger.verifyEquals(promotionId,ConflictProductsBea.getJSONObject("Data").getJSONArray("ConflictPromotions").getJSONObject(0).getInt("PromotionId"),"与创建的满减促销冲突活动ID");
			}catch(Exception e){
				Logger.fail(e);
			}
			
		}
		
		
		/*
		 * 存在指定商品A的促销和排除商品A,B的促销，新增指定商品促销(A,B)时：与指定商品A的促销冲突
		 */
		@Test
		@Category({P1.class})
		@TestCase
		public void Tc_CreateSellerPromotion_015(){
			Logger.start(false, "存在指定商品A的促销和排除商品A,B的促销，新增指定商品促销(A,B)时：与指定商品A的促销冲突");
			try{	
				int sellerId = 20323743;
				// 校验是否存在未开始或已开始的满减活动，若存在，则取消
				this.checkIsExistPromotion(sellerId);
				// 存在指定商品A的促销
				Map<String,Object> FirstpromotionMap = new HashMap<String,Object>();
				FirstpromotionMap.put("SellerId", sellerId);
				FirstpromotionMap.put("PromotionInfo->PromotionName","指定商品A促销");
				FirstpromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				FirstpromotionMap.put("PromotionInfo->PromotionType","4");
				FirstpromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				FirstpromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				FirstpromotionMap.put("PromotionInfo->IsSpecifyProduct",true);
				FirstpromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				FirstpromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				FirstpromotionMap.put("PromotionInfo->ProductIds",new JSONArray("[f0e7200f-2577-4a24-8d3b-45e76f7ab527]"));
				
				JSONObject FirstPromotionBean = new CreateSellerPromotionCall().callAndGetReturnData(FirstpromotionMap);
				// 创建排除商品A,B促销
				Map<String,Object> SecondPromotionMap = new HashMap<String,Object>();
				SecondPromotionMap.put("SellerId", sellerId);
				SecondPromotionMap.put("PromotionInfo->PromotionName","排除商品促销");
				SecondPromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-排除商品A,B,C促销-自动化测试");
				SecondPromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				SecondPromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				SecondPromotionMap.put("PromotionInfo->IsLimitProduct",true);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				JSONObject SecondPromotionBea = new CreateSellerPromotionCall().callAndGetReturnData(SecondPromotionMap);
				
				// 创建指定商品促销A,B
				Map<String,Object> thirdPromotionMap = new HashMap<String,Object>();
				thirdPromotionMap.put("SellerId", sellerId);
				thirdPromotionMap.put("PromotionInfo->PromotionName","指定商品A,B促销");
				thirdPromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				thirdPromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				thirdPromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				thirdPromotionMap.put("PromotionInfo->IsSpecifyProduct",true);
				thirdPromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				thirdPromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				thirdPromotionMap.put("PromotionInfo->ProductIds",new JSONArray("[f0e7200f-2577-4a24-8d3b-45e76f7ab527,bf92baaa-acb2-4de7-bb2d-792a5322bc02]"));
				JSONObject thirdPromotionBea = new CreateSellerPromotionCall().callAndGetReturnData(thirdPromotionMap);
				
				
				// 
				boolean SecondpromoitonFlg = SecondPromotionBea.getJSONObject("Data").getBoolean("IsSuccess");
				Logger.verifyEquals(true, SecondpromoitonFlg, "第二个满减促销创建成功");
				
				boolean thirdpromoitonFlg = thirdPromotionBea.getJSONObject("Data").getBoolean("IsSuccess");
				Logger.verifyEquals(false, thirdpromoitonFlg, "第三个满减促销创建失败");
				
				Logger.verifyEquals(2, thirdPromotionBea.getJSONObject("Data").getInt("ConflictType"), "满减促销商品冲突");
				Logger.verifyEquals(-1, thirdPromotionBea.getJSONObject("Data").getInt("PromotionId"), "促销创建失败返回促销错误ID：-1");
				

				//排除商品A的促销活动ID
				int  promotionId = FirstPromotionBean.getJSONObject("Data").getInt("PromotionId");
				// 校验SQL库Ymt_SellerPromotionProducts
				List<YmtSellerPromotionProducts> sellerPromotionProductsList = new YmtSellerPromotionProductsIMapper().selectProductsByPromotionId(promotionId);
				JSONArray prodSqlArray = new JSONArray();
				sellerPromotionProductsList.forEach(K->prodSqlArray.put(K.getProductId()));
				JSONArray conflictProductIds= thirdPromotionBea.getJSONObject("Data").getJSONArray("ConflictPromotions").getJSONObject(0).getJSONArray("ProductIds");	
				// 校校验冲突商品是否正确
				AssertService.checkArray(prodSqlArray, conflictProductIds);
			}catch(Exception e){
				Logger.fail(e);
			}
			
		}
		
		
		/*
		 * 存在指定商品A的促销,新增排除商品促销B时：与指定商品A的促销冲突
		 */
		@Test
		@Category({P1.class})
		@TestCase
		public void Tc_CreateSellerPromotion_016(){
			Logger.start(false, "存在指定商品A的促销,新增排除商品促销B时：与指定商品A的促销冲突");
			try{	
				int sellerId = 20323743;
				// 校验是否存在未开始或已开始的满减活动，若存在，则取消
				this.checkIsExistPromotion(sellerId);
				// 存在指定商品A的促销
				Map<String,Object> FirstpromotionMap = new HashMap<String,Object>();
				FirstpromotionMap.put("SellerId", sellerId);
				FirstpromotionMap.put("PromotionInfo->PromotionName","指定商品A促销");
				FirstpromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-自动化测试");
				FirstpromotionMap.put("PromotionInfo->PromotionType","4");
				FirstpromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				FirstpromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				FirstpromotionMap.put("PromotionInfo->IsSpecifyProduct",true);
				FirstpromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				FirstpromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				FirstpromotionMap.put("PromotionInfo->ProductIds",new JSONArray("[f0e7200f-2577-4a24-8d3b-45e76f7ab527]"));
				
				JSONObject FirstPromotionBean = new CreateSellerPromotionCall().callAndGetReturnData(FirstpromotionMap);
				// 创建排除商品B促销
				Map<String,Object> SecondPromotionMap = new HashMap<String,Object>();
				SecondPromotionMap.put("SellerId", sellerId);
				SecondPromotionMap.put("PromotionInfo->PromotionName","排除商品促销");
				SecondPromotionMap.put("PromotionInfo->PromotionDesc","满200减8.9-排除商品A,B,C促销-自动化测试");
				SecondPromotionMap.put("PromotionInfo->PromotionBeginTime",YMTDateUtil.getBeforeOrNextDay(0));
				SecondPromotionMap.put("PromotionInfo->PromotionEndTime",YMTDateUtil.getBeforeOrNextDay(3));
				SecondPromotionMap.put("PromotionInfo->IsLimitProduct",true);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->AmountCondition",200);
				SecondPromotionMap.put("PromotionInfo->PromotionValues[0]->Value",8.9);
				SecondPromotionMap.put("PromotionInfo->ProductIds",new JSONArray("[bf92baaa-acb2-4de7-bb2d-792a5322bc02]"));
				JSONObject SecondPromotionBea = new CreateSellerPromotionCall().callAndGetReturnData(SecondPromotionMap);
				
				//排除商品A的促销活动ID
				int  promotionId = FirstPromotionBean.getJSONObject("Data").getInt("PromotionId");
				// 校验SQL库Ymt_SellerPromotionProducts
				List<YmtSellerPromotionProducts> sellerPromotionProductsList = new YmtSellerPromotionProductsIMapper().selectProductsByPromotionId(promotionId);
				JSONArray prodSqlArray = new JSONArray();
				sellerPromotionProductsList.forEach(K->prodSqlArray.put(K.getProductId()));
				JSONArray conflictProductIds= SecondPromotionBea.getJSONObject("Data").getJSONArray("ConflictPromotions").getJSONObject(0).getJSONArray("ProductIds");	
				// 校校验冲突商品是否正确
				AssertService.checkArray(prodSqlArray, conflictProductIds);
				boolean SecondpromoitonFlg = SecondPromotionBea.getJSONObject("Data").getBoolean("IsSuccess");
				Logger.verifyEquals(false, SecondpromoitonFlg, "第二个满减促销创建失败");
				
			}catch(Exception e){
				Logger.fail(e);
			}
			
		}
		
		/*
		 * 取消已经存在的满减促销活动
		 */
		public void checkIsExistPromotion(Integer sellerID) throws InterruptedException, JSONException{
			// 校验是否存在未开始或已开始的满减活动，若存在，则取消
			List<YmtSellerPromotion> sellerPromotionIDlist = new YmtSellerPromotionIMapper().selectPromotionBySellerId(sellerID);
			if(sellerPromotionIDlist.size() > 0){
				for(int i=0;i<sellerPromotionIDlist.size();i++){
					Map<String,Object> promotionIdmap= new HashMap<String,Object>();
					promotionIdmap.put("PromotionId",sellerPromotionIDlist.get(i).getPromotionId());
					promotionIdmap.put("SellerId",20323743);
					if(sellerPromotionIDlist.get(i).getPromotionState() == 0){
						promotionIdmap.put("OperatorType",1);
					} else{
						promotionIdmap.put("OperatorType",2);
					}
					
					JSONObject CancelOrEndPromotionretBea = new CancelOrEndPromotionCall().callAndGetReturnData(promotionIdmap);
					boolean flag = CancelOrEndPromotionretBea.getJSONObject("Data").getBoolean("IsSuccess");
					Logger.verifyEquals(true, flag, "验证促销活动是否成功取消");
					
					int code =CancelOrEndPromotionretBea.getInt("Code");
					Logger.verifyEquals(200, code, "code是否等于200");
				}
			}else{
			}
			
		}
		
}
